import {fromJS} from 'immutable'
import {actionTypes} from './index'
import en_US from '@/locale/en_US'

const defaultState = fromJS({
    locale: 'en',
    localeMessage: en_US,
})

export default (state = defaultState, action) => {
    switch (action.type) {
        case actionTypes.CHANGE_LOCALE:
            return state.merge(action.value)
        default:
            return state
    }
}
